package cn.iocoder.yudao.framework.security.core.util;

import cn.dev33.satoken.stp.StpUtil;
import cn.iocoder.yudao.framework.common.auth.LoginUser;
import cn.iocoder.yudao.framework.web.core.util.BaseController;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SaBaseController extends BaseController {

    public void putToSession(String key, Object value) {
        StpUtil.getSession().set(key, value);
    }

    public <T> T getFromSession(String key) {
        try {
            return (T) StpUtil.getSession().get(key);
        } catch (Exception e) {
           log.warn("");
        }
        return null;
    }

    public LoginUser getLoginUser() {
        return SecurityFrameworkUtils.getLoginUser();
    }

}
